var CGI = {
	NOTICE_MAIN: function (){return window.frontPath + 'notice/pagingPageContent?catalogId=4&pageIndex=1&pageSize=8&r='+new Date().getTime()}//查询系统公告
};
function reloadUserInfo(){
	$.ajax({
		url 	: window.frontPath + "user/info_json?r=" + new Date().getTime(),
		method 	: 'GET',
		success : function(data){
			$('#user_name').html(data.userName || "未知");
			$('#user_coin').html(data.coin || 0);
		}
	});
};

$.ajax({
	url 	: CGI.NOTICE_MAIN(),
	method 	: 'GET',
	success : function(data){
		if(data.retcode == 0){
			var native_title_template = '<marquee onmouseover="this.stop()" onmouseout="this.start()" scrollamount="1" scrolldelay="100" style="height:26px; line-height:26px; overflow:hidden;" direction="up"><%_.each(items,function(item,index) {%><a href="<%=item.href%>"><%=index+1%>. <%=item.pageTitle%></a><%})%></marquee>';
			var _itemlist = data.data.list;
			for (var i = 0; i < _itemlist.length; i++) {
				_itemlist[i]['href'] = window.frontPath + '#/notice/detail/' + _itemlist[i]['id'];
			};
			$('#side-news').html(_.template(native_title_template , {items : _itemlist}));
		}else{
			$.exception(data.retcode,data.retmsg);
		}
	}
});

$(function(){
	reloadUserInfo();
})